package com.ronan.imweb.controller;

import com.ronan.common.pojo.SendMsgReq;
import com.ronan.common.pojo.SendMsgVo;
import com.ronan.common.response.Result;
import com.ronan.imweb.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * FileName    : com.ronan.imweb.controller
 * Description : 负责消息推送
 * <p>
 * 消息推送:
 * 点对点
 * 群聊
 *
 * @author : ronan
 * @version : 1.0
 * Create Date : 2021/2/27 17:37
 **/
@RestController
@RequestMapping(value = "/im/web/message")
public class MessageController {


    @Autowired
    private MessageService messageService;

    /**
     * v1消息推送
     * 发送者 接收者
     *
     * @param req 请求参数
     * @return {@link Result<SendMsgVo>}
     */
    @PostMapping(value = "/v1SendMessage")
    public Result<SendMsgVo> v1SendMessage(@RequestBody @Validated SendMsgReq req) {
        return messageService.v1SendMessage(req);
    }
}
